import React from 'react';
import Taro, { useShareAppMessage } from '@tarojs/taro';
import { View, Image, Button } from '@tarojs/components';
import pshare from '@/images/common/share.png';

import './index.scss';

/*
功能：分享页面给微信好友
@message: 消息内容
*/
const SharePageToWxFriend = ({ message = {} }) => {
  useShareAppMessage((res) => {
    console.log('ShareAppMessage res:', res);
    const { title = '', path = '/', imageUrl } = message;
    return {
      title,
      path,
      imageUrl,
    };
  });

  return (
    <View className={'sharePageContent' + (Taro.$isIphoneX ? ' highBottom' : '')}>
      <Button openType="share" className="share nobtn">
        <Image className="shareImg" src={pshare} />
      </Button>
    </View>
  );
};

export default SharePageToWxFriend;
